package com.magic.gre.ui.dialog;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.view.View;
import android.widget.TextView;

import com.magic.gre.R;
import com.magic.gre.base.dialog.BaseCenterDialog;
import com.magic.gre.ui.activity.LearnFinishActivity;

/**
 * Author: Lmoumou
 * Date: 2019-01-08 16:22
 * 文件名: LearnFinishDialog
 * 描述:
 */
public class LearnFinishDialog extends BaseCenterDialog {

    private TextView contentTv;
    private int allNum = 0;
    private OnLearnFinishlistener onLearnFinishlistener;

    public void setOnLearnFinishlistener(OnLearnFinishlistener onLearnFinishlistener) {
        this.onLearnFinishlistener = onLearnFinishlistener;
    }

    @Override
    protected Float setDialogWith() {
        return 0.7F;
    }

    @Override
    protected int setViewId() {
        return R.layout.dialog_learn_finish;
    }

    @SuppressLint("SetTextI18n")
    @Override
    protected void initView(View view) {
        contentTv = view.findViewById(R.id.content_tv);
        contentTv.setText("成功学完" + String.valueOf(allNum) + "词");
        view.findViewById(R.id.next_tv).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (onLearnFinishlistener!=null){
                    dismissThis(isResumed());
                    onLearnFinishlistener.onNextClick();
                }

            }
        });
    }


    public void showThis(FragmentManager manager, String tag, int allNum) {
        super.showThis(manager, tag);
        this.allNum = allNum;

    }

    @Override
    protected void initBundle(Bundle bundle) {

    }

    public interface OnLearnFinishlistener{
        void onNextClick();
    }
}
